package org.komarichin.beans.service;

import org.komarichin.beans.IBlog;
import org.komarichin.beans.IComment;
import org.komarichin.beans.IPost;

import java.io.Serializable;
import java.util.Collection;

/**
 * User: Mykhaylo Komarichyn
 * Date: 19.03.2010
 * Time: 15:33:55
 */
public interface IBloggerService<PK> extends Serializable {
    /**
     * @param comment comment for insertion to db
     * @param postId  identifier of post when insertion comment
     */
    void createComment(IComment comment, PK postId);

    /**
     * @param post insertion post
     */
    void createPost(IPost post);

    /**
     * @param postId identifier post
     * @return collection of comments for post id
     */
    Collection<IComment> getComments(PK postId);

    /**
     * @return collection of post
     */
    Collection<IPost> getPosts();

    /**
     * @return blog {@link org.komarichin.beans.IBlog}
     */
    IBlog getBlog();

    /**
     * @param postId post identifier
     * @return post by identifier {@link org.komarichin.beans.IPost}
     */
    IPost<PK> getPost(PK postId);

    /**
     * @return collection of latest posts
     */
    Collection<IPost> getLatestPost();
}
